<template>
  <div
    class="btn"
    :class="{success:type=='success',danger:type=='danger',primary:type=='primary'}"
    @click="handlerClick"
  >
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    type: {
      type: String
    }
  },
  methods: {
    handlerClick(e) {
      // console.log(1);
      // 子传父
      this.$emit("click", e);
    }
  }
};
</script>

<style lang="less" scoped>
.btn {
  width: 314 * 100vw/360;
  height: 50px;
  background-color: rgb(173, 174, 172);
  border-radius: 25px;
  line-height: 50px;
  border: 1px solid #ccc;
  text-align: center;
  margin: 0 auto;
  font-size: 20px;
  color: #666;
}
.success {
  background-color: greenyellow;
  color: #fff;
}
.danger {
  background-color: red;
  color: #fff;
}
.primary {
  background-color: skyblue;
  color: #fff;
}
</style>